class UserModel {

  int code;
  UserInfo data;
  String msg;

  UserModel({this.code, this.data, this.msg});

  bool success() {
    return this.msg == 'SUCCESS' || this.msg == 'success';
  }

  UserModel.fromJson(Map<String, dynamic> json) {
    code = json['code'];
    data = UserInfo.fromJson(json['data']);
    msg = json['msg'] == "User has not logged in yet"? "账户在其他设备登录": json['msg'];
  }
}

class UserInfo {
  String id;
  String phone;
  String name;

  // 经度
  double longitude;

  // 纬度
  double latitude;

  // base64编码的二维码图片
  String qrCodeImage;

  UserInfo(
      {this.id,
      this.phone,
      this.name,
      this.longitude,
      this.latitude,
      this.qrCodeImage});

  UserInfo.fromJson(Map<String, dynamic> json) {
    id = json["id"];
    phone = json["phone"];
    name = json["name"];
    longitude = json["longitude"];
    latitude = json["latitude"];
    qrCodeImage = json["qrCodeImage"];
  }
}
